from threading import Thread
import sys
from common.utility import Utility

# 主函数
def main(thread_count: int = 500):
    global count
    Utility.print_info('entered.')
    threads: list[Thread] = []
    for i in range(thread_count):
        threads.append(start_thread())
    for thread in threads:
        thread.join()
    Utility.print_info(f'exited. count is {count}.')

# 创建线程
def start_thread() -> Thread:
    thread: Thread = Thread(target=task)
    thread.start()
    return thread

# 任务
def task() -> None:
    global count
    count = count + count*10 + count*90 - count*100 + 1

print(f'is gil enabled: {sys._is_gil_enabled()}')
print(f'python version: {sys.version}')
count: int = 0
main(50000)
